<form nz-form [formGroup]="loginModalForm">
  <nz-form-item>
    <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="userName">用户名</nz-form-label>
    <nz-form-control [nzSm]="14" [nzXs]="24" [nzErrorTip]="combineTpl">
      <input nz-input formControlName="userName" id="userName" placeholder="用户名"/>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="password">密码</nz-form-label>
    <nz-form-control [nzSm]="14" [nzXs]="24" [nzErrorTip]="combineTpl">
      <input nz-input formControlName="password" name="password" placeholder="请输入密码" id="password"/>
    </nz-form-control>
  </nz-form-item>
</form>

<ng-template #combineTpl let-control>
  <ng-container *ngIf="control.hasError('required')">必填项</ng-container>
</ng-template>
